{% extends 'content/base.html' %}
{% load thumbnail %}
{% block content %}
    <table>
        <tr>
            <td>搜索</td>
            <td><input type="text" class="form-control"></td>
            <td>
                <button  class="button">提交</button>
            </td>
        </tr>
    </table>
    <table class="table">
        <thead>
        <tr>
            <th>商品图</th>
            <th> 名称</th>
            <th> 价格</th>
            <th>优惠券</th>
            <th>佣金</th>
            <th> 月销量</th>
            <th> 领券</th>
            <th> 下单</th>
        </tr>
        </thead>
        {% for g in goods %}
            <tr>
                <td>
                    {% thumbnail g.goods_image "160x160" crop="center" as im %}
                        <img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
                    {% endthumbnail %}
                </td>
                <td><a href="{{ g.tbk_url }}" target="_blank">{{ g.goods_name }}</a></td>
                <td>{{ g.goods_price }}</td>
                <td>{{ g.coupon_value }}</td>
                <td>{{ g.commission }}</td>
                <td>{{ g.goods_sales }}</td>
                {# 领券 #}
                <td><a href="{{ g.goods_coupon_spread_url }}" target="_blank" class="button">领券</a></td>
                {# 下单 #}
                <td><a href="{{ g.tbk_url }}" target="_blank" class="button">下单</a></td>
            </tr>
        {% endfor %}
    </table>
    <div class="pagination">
    <span class="step-links">
        {% if goods.has_previous %}
            <a href="?page=1">&laquo; 第1页</a>
            <a href="?page={{ goods.previous_page_number }}">前一页</a>
        {% endif %}

        <span class="current">
            Page {{ goods.number }} / {{ goods.paginator.num_pages }}.
        </span>

        {% if goods.has_next %}
            <a href="?page={{ goods.next_page_number }}">后一页</a>
            <a href="{% url 'content:index' %}?page={{ goods.paginator.num_pages }}">末页 &raquo;</a>
        {% endif %}
    </span>
    </div>
{% endblock content %}